package com.ahm.service.impl;

import com.ahm.feign.ProductService;
import com.ahm.pojo.Order;
import com.ahm.pojo.Product;
import com.ahm.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Arrays;
import java.util.Map;

/**
 * @author anhaimeng
 * @title: OrderServiceImpl
 * @projectName feign-demo
 * @description: TODO
 * @date 2021/10/1917:55
 */
/*功能描述
 * @author ahm
 */
@Service
public class OrderServiceImpl implements OrderService {


    @Autowired
    private ProductService productService;

//
//
//    @Override
//    public Order selectOrderById(Integer id) {
//
//        return new Order(id,"sjdkfs010","shanxi",32.0D,productService.selectAllProduct());
//    }

    @Override
    public Order selectOrderById(Integer id) {

        return new Order(id,"sjdkfs010","shanxi",32.0D, Arrays.asList(productService.selectProductById(id)));
    }

    @Override
    public Map<String, Object> saveProduct(Product product) {
        return productService.save(product);
    }
}
